package jgl.vajra.management.part.vehicle.activity;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ImageSpan;

import jgl.vajra.management.R;
import jgl.vajra.management.databinding.ActivityPricingRulesBinding;
import jgl.vajra.management.manager.IntentManager;
import jgl.vajra.management.part.vehicle.contract.PricingRulesContract;
import jgl.vajra.management.part.vehicle.viewModel.PricingRulesViewModel;
import jgl.vajra.management.widget.mvvm.factory.CreateViewModel;
import jgl.vajra.management.widget.mvvm.view.BaseMVVMActivity;

@CreateViewModel(PricingRulesViewModel.class)
public class PricingRulesActivity extends BaseMVVMActivity<PricingRulesViewModel, ActivityPricingRulesBinding> implements PricingRulesContract.View {
    @Override
    public int getLayoutId() {
        return R.layout.activity_pricing_rules;
    }

    @Override
    public void initView() {
        super.initView();
        mBinding.setView(this);

        //文字末尾加图标
        Bitmap bitmap = BitmapFactory.decodeResource(getApplication().getResources(), R.drawable.ic_preferential_rules);
        ImageSpan imgSpan = new ImageSpan(getApplicationContext(), bitmap);
        SpannableString spanString = new SpannableString("icon");
        spanString.setSpan(imgSpan, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        mBinding.tvPreferentialRules.append(spanString);
    }

    @Override
    public void onPreferentialRules() {
        IntentManager.toCumulativeDiscountActivity(this);
    }
}
